package com.bwf.obj;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/13 10:00
 * @Copyright 博为峰
 */
public class Student {
    private String name;
    private int age;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int hashCode() {
        return this.age + this.name.hashCode();
    }

    public boolean equals(Object obj) {//Object obj = s2
        Student s2 = (Student) obj;
        if (this.getName().equals(s2.getName()) && this.getAge() == s2.getAge()) {
            return true;
        } else {
            return false;
        }
    }

    public String toString() {
        return this.name + "," + this.age;
    }
}
